﻿using Medical.Domain.RBAC;
using Medical.ErrorCode;

namespace Medical.Api.Write.Service.RBAC
{
    public interface IRBACService
    {
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        ApiResult<int> CreateUser(UserModel user, List<int> RoleIds);
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        ApiResult<int> CreateRole(RoleModel role,List<int> PermissionIds);
        /// <summary>
        /// 创建权限
        /// </summary>
        /// <param name="permission"></param>
        /// <returns></returns>
        ApiResult<int> CreatePermission(PermissionModel permission);

        /// <summary>
        /// 修改用户
        /// </summary>
        ApiResult<int> UpdateUser(UserModel user);
        /// <summary>
        /// 逻辑删除用户
        /// </summary>
        ApiResult<int> DeleteUser(int userId);
        /// <summary>
        /// 修改角色
        /// </summary>
        ApiResult<int> UpdateRole(RoleModel role);
        /// <summary>
        /// 逻辑删除角色
        /// </summary>
        ApiResult<int> DeleteRole(int roleId);
        /// <summary>
        /// 修改权限
        /// </summary>
        ApiResult<int> UpdatePermission(PermissionModel permission);
        /// <summary>
        /// 逻辑删除权限
        /// </summary>
        ApiResult<int> DeletePermission(int permissionId);
        /// <summary>
        /// 检查用户名是否唯一
        /// </summary>
        ApiResult<bool> CheckUserNameUnique(string userName, int? userId = null);
        /// <summary>
        /// 检查角色名是否唯一
        /// </summary>
        ApiResult<bool> CheckRoleNameUnique(string roleName, int? roleId = null);
        /// <summary>
        /// 检查权限名是否唯一
        /// </summary>
        ApiResult<bool> CheckPermissionNameUnique(string permissionName, int? permissionId = null);


    }
}
